package com.dy.design_pattern_study.memento_pattern.dome1;

/**
 * @CreateBy zhangdingyi
 * @Date 2023-04-10
 * @Content 游戏客户端调用
 */
public class client {
    public static void main(String[] args) {
        //boss战前 -获得初始化角色状态
        GameRole lixiaoyao = new GameRole();
        lixiaoyao.getInitState();
        lixiaoyao.stateDisplay();

        //保存进度 -创建新实例保存角色初始化状态
        //这里暴露设置状态的细节  -不足取
        GameRole backup = new GameRole();
        backup.setVit(lixiaoyao.getVit());
        backup.setAtk(lixiaoyao.getAtk());
        backup.setDef(lixiaoyao.getDef());

        //boss战中 -消耗状态
        lixiaoyao.fight();
        lixiaoyao.stateDisplay();

        //结束boss战，状态恢复 -把原先备份的状态还原
        //这里暴露设置状态的细节  -不足取
        lixiaoyao.setVit(backup.getVit());
        lixiaoyao.setAtk(backup.getAtk());
        lixiaoyao.setDef(backup.getDef());

        lixiaoyao.stateDisplay();

        //正常的情况下，应当把细节封装成一个类，面向对象，而不是面向细节

    }
}
